package com.lf.service.impl;

import com.lf.constant.ConstantsValue;
import com.lf.entity.ApplyAuthEntity;
import com.lf.mapper.*;
import com.lf.service.ITaskService;
import com.lf.util.VoiceTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description:
 * @Param:
 * @return:
 * @Author: GXL
 * @Date: 2019/12/09
 */
@Slf4j
@Service
public class TaskServiceImpl extends MapperList implements ITaskService {

    @Transactional(propagation=Propagation.REQUIRED)
    @Override
    public void RewardTask() {
        Long nowTime = new Date().getTime();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        Long rewardDateForFind = Long.valueOf(dateFormat.format(nowTime));
    }

    @Transactional(propagation=Propagation.REQUIRED)
    @Override
    public void ExamineTipTask() {
        if (ConstantsValue.isWindows){
            ApplyAuthEntity applyAuthEntity = new ApplyAuthEntity();
            applyAuthEntity.setIsExamina(ConstantsValue.AUTH_ING);
            int count = applyAuthMapper.selectCount(applyAuthEntity);
            if (count > 0){
                VoiceTools.textToSpeech("又有新的用户需要认证审核啦");
            }
        }
    }


}
